/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.com.cotelasa.scp.entidad;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author WINDOWS 7
 */
@Entity
@Table(name = "material_consumido", catalog = "bdcotelasa", schema = "cotelasa")
@NamedQueries({
    @NamedQuery(name = "MaterialConsumido.findAll", query = "SELECT m FROM MaterialConsumido m"),
    @NamedQuery(name = "MaterialConsumido.findById", query = "SELECT m FROM MaterialConsumido m WHERE m.id = :id"),
    @NamedQuery(name = "MaterialConsumido.findByIdDetalleGuia", query = "SELECT m FROM MaterialConsumido m WHERE m.idDetalleGuia = :idDetalleGuia"),
    @NamedQuery(name = "MaterialConsumido.findByPartidaLote", query = "SELECT m FROM MaterialConsumido m WHERE m.partidaLote = :partidaLote"),
    @NamedQuery(name = "MaterialConsumido.findByCantidadConsumida", query = "SELECT m FROM MaterialConsumido m WHERE m.cantidadConsumida = :cantidadConsumida"),
    @NamedQuery(name = "MaterialConsumido.findByValorCosto", query = "SELECT m FROM MaterialConsumido m WHERE m.valorCosto = :valorCosto"),
    @NamedQuery(name = "MaterialConsumido.findByValorTotal", query = "SELECT m FROM MaterialConsumido m WHERE m.valorTotal = :valorTotal"),
    @NamedQuery(name = "MaterialConsumido.findByEstadoRegistro", query = "SELECT m FROM MaterialConsumido m WHERE m.estadoRegistro = :estadoRegistro"),
    @NamedQuery(name = "MaterialConsumido.findByUsrCreacion", query = "SELECT m FROM MaterialConsumido m WHERE m.usrCreacion = :usrCreacion"),
    @NamedQuery(name = "MaterialConsumido.findByFecCreacion", query = "SELECT m FROM MaterialConsumido m WHERE m.fecCreacion = :fecCreacion"),
    @NamedQuery(name = "MaterialConsumido.findByUsrModificacion", query = "SELECT m FROM MaterialConsumido m WHERE m.usrModificacion = :usrModificacion"),
    @NamedQuery(name = "MaterialConsumido.findByFecModificacion", query = "SELECT m FROM MaterialConsumido m WHERE m.fecModificacion = :fecModificacion")})
public class MaterialConsumido implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    @Id
    @SequenceGenerator(name = "generadorMaterialConsumido", sequenceName = "cotelasa.material_consumido_id_seq")
    @GeneratedValue(generator = "generadorMaterialConsumido")
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "partida_lote")
    private String partidaLote;
    
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "cantidad_consumida")
    private BigDecimal cantidadConsumida;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "valor_costo")
    private BigDecimal valorCosto;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "valor_total")
    private BigDecimal valorTotal;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "estado_registro")
    private char estadoRegistro;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "usr_creacion")
    private String usrCreacion;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "fec_creacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecCreacion;
    
    @Size(max = 20)
    @Column(name = "usr_modificacion")
    private String usrModificacion;
    
    @Column(name = "fec_modificacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecModificacion;
    
    @JoinColumn(name = "id_sede", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Sede idSede;
    
    @JoinColumn(name = "id_articulo", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Articulo idArticulo;
    
    @JoinColumn(name = "id_detalle_guia", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private DetalleGuiaRemision idDetalleGuia;
    
    public MaterialConsumido() {
    }

    public MaterialConsumido(Integer id) {
        this.id = id;
    }
 
    public MaterialConsumido(Integer id,String partidaLote, char estadoRegistro, String usrCreacion, Date fecCreacion) {
        this.id = id;
        this.partidaLote = partidaLote;
        this.estadoRegistro = estadoRegistro;
        this.usrCreacion = usrCreacion;
        this.fecCreacion = fecCreacion;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }


    public String getPartidaLote() {
        return partidaLote;
    }

    public void setPartidaLote(String partidaLote) {
        this.partidaLote = partidaLote;
    }

    public BigDecimal getCantidadConsumida() {
        return cantidadConsumida;
    }

    public void setCantidadConsumida(BigDecimal cantidadConsumida) {
        this.cantidadConsumida = cantidadConsumida;
    }

    public BigDecimal getValorCosto() {
        return valorCosto;
    }

    public void setValorCosto(BigDecimal valorCosto) {
        this.valorCosto = valorCosto;
    }

    public char getEstadoRegistro() {
        return estadoRegistro;
    }

    public void setEstadoRegistro(char estadoRegistro) {
        this.estadoRegistro = estadoRegistro;
    }

    public String getUsrCreacion() {
        return usrCreacion;
    }

    public void setUsrCreacion(String usrCreacion) {
        this.usrCreacion = usrCreacion;
    }

    public Date getFecCreacion() {
        return fecCreacion;
    }

    public void setFecCreacion(Date fecCreacion) {
        this.fecCreacion = fecCreacion;
    }

    public String getUsrModificacion() {
        return usrModificacion;
    }

    public void setUsrModificacion(String usrModificacion) {
        this.usrModificacion = usrModificacion;
    }

    public Date getFecModificacion() {
        return fecModificacion;
    }

    public void setFecModificacion(Date fecModificacion) {
        this.fecModificacion = fecModificacion;
    }

    public Sede getIdSede() {
        return idSede;
    }

    public void setIdSede(Sede idSede) {
        this.idSede = idSede;
    }

    public Articulo getIdArticulo() {
        return idArticulo;
    }

    public void setIdArticulo(Articulo idArticulo) {
        this.idArticulo = idArticulo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MaterialConsumido)) {
            return false;
        }
        MaterialConsumido other = (MaterialConsumido) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.com.cotelasa.scp.entidad.MaterialCunsumido[ id=" + id + " ]";
    }

    public DetalleGuiaRemision getIdDetalleGuia() {
        return idDetalleGuia;
    }

    public void setIdDetalleGuia(DetalleGuiaRemision idDetalleGuia) {
        this.idDetalleGuia = idDetalleGuia;
    }

    public BigDecimal getValorTotal() {
        return valorTotal;
    }

    public void setValorTotal(BigDecimal valorTotal) {
        this.valorTotal = valorTotal;
    }
    
}
